home *** CD-ROM | disk | FTP | other *** search
- ;bush.pog - recursively draw a fractal looking bush using Pogo turtle
- ;graphics. Save it as BUSH.PC1 when done.
-
- ;This is the tricky recursive part...
- to branches(len, color, dir)
- {
- if (len < 1) ; if length too short bail out
- return;
- PenColor(color)
- Forward(len)
- Left(dir)
- branches(60*len/100, color+1, dir) ;call self for next (smaller) branch to left
- Right(dir)
- branches(30*len/100, color+1, dir) ;and tiny branch in middle
- Right(dir)
- branches(60*len/100, color+1, dir) ;and branch to right
-
- ;now lift up the pen and move turtle back to where it was when this
- ;branch started.
- PenUp()
- Left(dir)
- Reverse(len)
- PenDown()
- }
-
- ;generate a nice blue to bright blue-green spectrum of colors.
- function make_colors()
- {
- int i
-
- for i = 1 to 10
- setcolor(i, i, 25*i, 250)
- }
-
-
- ToGraphics()
- make_colors()
- PenUp() ;start Turtle below screen so can see crown of bush
- Reverse(200)
- PenDown()
- ClearScreen()
- branches(120, 1, 39)
- SavePic("BUSH.PC1");
- WaitKey()
-
-